/*
 * @Author: 吴世扬 18368095041@163.com
 * @Date: 2025-02-19 09:43:57
 * @LastEditors: 吴世扬 18368095041@163.com
 * @LastEditTime: 2025-05-28 09:55:16
 * @FilePath: /vue3-admin-server/src/common/dto/menu.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { IsNotEmpty, IsNumber, IsString } from 'class-validator';

import { MenuEntity } from 'src/entities/menu.entity';

import { PageDTO } from './page';

export class MenuListDTO extends PageDTO<MenuEntity> {
    @IsString({ message: '菜单名称必须为字符串' })
    name?: string;
}

export class MenuDTO {
    @IsNumber(undefined, {
        message: '菜单id必须为数字'
    })
    id?: number;

    @IsNotEmpty({ message: '菜单名称不能为空' })
    @IsString({ message: '菜单名称必须为字符串' })
    name: string;

    @IsString({ message: '菜单名称必须为字符串' })
    path?: string;

    @IsNumber(undefined, {
        message: '菜单父级id必须为数字'
    })
    parentId?: number;

    @IsString({ message: '菜单图标必须为字符串' })
    icon?: string;

    @IsNotEmpty({ message: '菜单权重不能为空' })
    @IsNumber(undefined, {
        message: '菜单权重必须为数字'
    })
    sortWeight: number;
}
